#pragma once
#include "DeviceResource.h"
#include "StepTimer.h"
#include "UIManager.h"
#include "Font.h"
#include "SampleList.h"
using namespace DX;
class Game final : public IDeviceNotify
{
public:


    ~Game();

    Game(Game&&) = default;
    Game& operator= (Game&&) = default;

    Game(Game const&) = delete;
    Game& operator= (Game const&) = delete;

    void Initialize(HINSTANCE hInts);
    void Run();

private:
    Game();
    void Update(DX::StepTimer const& timer);
    void Render();
    void Clear();

    void CreateDeviceDependentResources();
    void CreateWindowSizeDependentResources();
    void CreateWindowClass(HINSTANCE hInstance);
public:
    // IDeviceNotify
    void OnDeviceLost() override;
    void OnDeviceRestored() override;

    // Messages
    void OnActivated();
    void OnDeactivated();
    void OnSuspending();
    void OnResuming();
    void OnWindowMoved();
    void OnWindowSizeChanged(int width, int height);

    // Properties
    void GetDefaultSize(int& width, int& height) const noexcept;
    static Game* GetInstance();
    Font* GetFont();
    StepTimer* GetTimer();
private:
    std::unique_ptr<DeviceResources>        m_deviceResources;
    std::unique_ptr<UIManager>              m_uiLayer;
    std::unique_ptr<Font>                   m_font;
    std::unique_ptr<SampleList>             m_samplelist;
    StepTimer                               m_timer;
    static Game*                            g_game;
};

